#!/usr/bin/env python
#encoding=utf-8
import socket
import threading
import socketserver
import sys,os,time


def client(ip, port, message):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
        sock.connect((ip, port))
        sock.sendall(bytes(message, 'ascii'))
        response = str(sock.recv(1024), 'ascii')
        print("Received: {}".format(response))


if __name__ == "__main__":
    while True:
        client('localhost', 18003, "Hello World 1")
        time.sleep(2)
    #client('localhost', 18003, "Hello World 2")
    #client('localhost', 18003, "Hello World 3")